/*
 * MCAL_UART.h
 *
 *  Created on: Sep 24, 2025
 *      Author: ADMIN
 */

#ifndef BSW_MACL_INC_MCAL_UART_H_
#define BSW_MACL_INC_MCAL_UART_H_

/***********************************************************************************
 ********************************************************************************
 *--------------------------------------------------------------------------
 *                            FILE DESCRIPTION
 *--------------------------------------------------------------------------
 *
 *    File Name    :     MCAL_UART.h
 *    File Module  :     BSW_MCAL
 *    File Description:  This file is used to define function about UART messeage receive
 *                       and send and diagnose
 *
 *
 ********************************************************************************
 ***********************************************************************************/
#include "All_In_One.h"

/* UART CONTRAL STRUCT */
typedef struct UART_ID_Type UART_ID_Type;
struct UART_ID_Type{
    /* SW information */
    UART_HandleTypeDef* uartHandle;

    /* Send configure information */
    uint8 SendByteArr;
    uint8* SendDateIndex;
    uint16 SendByteLen;

    /* Receive configure information */
    uint8 ReceiveByteArr;
    uint16 ReceiveByteLen;
    uint16 ReceiveByteCnt;
    uint8* ReceiveDateIndex;

    /* Function Index */
    Std_ReturnType (*Send_ByteDate)    (struct  UART_ID_Type* uart_num);
    Std_ReturnType (*Send_Date)        (struct  UART_ID_Type* uart_num);
};

Std_ReturnType MCAL_USART_Init(void);
Std_ReturnType MCAL_USART_DeInit(void);
Std_ReturnType USART_SendByteDate(UART_ID_Type* uart_num);
Std_ReturnType USART_SendDate(UART_ID_Type* uart_num);

void USART_Creat(UART_ID_Type* uart_num, UART_HandleTypeDef* uartHandle);

/* Be defined GLOABAL UART_ID */
extern UART_ID_Type UART_ID_0x01;
#define Printf_UART_Type  UART_ID_0x01

extern UART_ID_Type UART_ID_0x03;
#define RS485_UART_Type  UART_ID_0x03
#endif /* BSW_MACL_INC_MCAL_UART_H_ */
